/**
 * 
 */
package com.pcbly.web.components.taglib.tag;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;

import com.opensymphony.xwork2.util.ValueStack;
import com.pcbly.web.components.taglib.Page;

/**
 * @author carl.song
 * @date 2009-7-16
 * @copyright lightsoft
 */
public class PageTag extends ComponentTagSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5959414062332273692L;
	
	private String totalPage;
	
	private String totalNumber;
	
	private String curPage;
	
	private String pageSize;
	
	private String theme;
	
	private String cssClass;
	
	private String style;
	
	private String image;
	
	private String href;
	
	public void setTheme(String theme) {
		this.theme = theme;
	}

	public void setCssClass(String cssClass) {
		this.cssClass = cssClass;
	}

	public void setStyle(String style) {
		this.style = style;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public void setHref(String href) {
		this.href = href;
	}

	public void setTotalPage(String totalPage) {
		this.totalPage = totalPage;
	}

	public void setTotalNumber(String totalNumber) {
		this.totalNumber = totalNumber;
	}

	public void setCurPage(String curPage) {
		this.curPage = curPage;
	}

	public void setPageSize(String pageSize) {
		this.pageSize = pageSize;
	}

	/**
	 * 
	 */
	public PageTag() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

	@Override
	public Component getBean(ValueStack stack, HttpServletRequest request,
			HttpServletResponse response) {
		// TODO Auto-generated method stub
		return new Page(stack);
	}
	protected void populateParams() {  
		super.populateParams();  


		Page page = (Page)component; 
		
		page.setCssClass(cssClass);
		
		page.setTotalPage(totalPage);
		
		page.setTotalNumber(totalNumber);
		
		page.setCurPage(curPage);
		
		page.setPageSize(pageSize);
		
		page.setTheme(theme);
		
		page.setStyle(style);
		
		page.setImage(image);
		
		page.setHref(href);
		
	}
}
